//
// Created by Felix on 24-5-16.
//

#ifndef GAZE_CAMERASERVICE_CPP_H
#define GAZE_CAMERASERVICE_CPP_H

#include "oatpp/web/protocol/http/Http.hpp"
#include "oatpp/core/macro/component.hpp"

#include "common.hpp"

#include "dto/DTOs.hpp"
#include "db/CameraDb.hpp"
#include "dto/CameraResponseDto.hpp"
#include "dto/CameraCreateDto.hpp"
#include "dto/CameraUpdateDetailsDto.hpp"
#include "dto/CameraUpdateStatusDto.hpp"
#include "dto/CameraServiceGetAllCameraQueryDto.hpp"

class CameraService {
private:
    typedef oatpp::web::protocol::http::Status Status;
    OATPP_COMPONENT(std::shared_ptr<CameraDb>, iCameraDatabase);
public:
    oatpp::Object<CameraResponseDto> createCamera(
            const oatpp::Object<CameraCreateDto> &dto
    ); // Create camera
    oatpp::Object<CameraResponseDto> updateCameraDetails(
            const oatpp::Object<CameraUpdateDetailsDto> &dto
    ); // Update camera details
    oatpp::Object<CameraResponseDto> updateCameraStatus(
            const oatpp::Object<CameraUpdateStatusDto> &dto
    ); // Update camera status
    oatpp::Object<CameraResponseDto> getCameraById(
            const oatpp::Int32 &cameraId
    ); // Get camera by id
    oatpp::Object<PageResponseDto<oatpp::Object<CameraResponseDto>>> getAllCamera(
            const oatpp::Int32 &page, const oatpp::Int32 &pageSize,
            const oatpp::Object<CameraServiceGetAllCameraQueryDto> &queryDto
    ); // Get all camera
private:
    static oatpp::Object<CameraModel> cameraModelFromCreateDto(const oatpp::Object<CameraCreateDto> &dto); //
    static oatpp::Object<CameraResponseDto> cameraResponseDtoFromModel(const oatpp::Object<CameraModel> &model); //
    static oatpp::Object<CameraModel> cameraModelFromUpdateDetailsDto(
            const oatpp::Object<CameraUpdateDetailsDto> &dto
    ); //
    static oatpp::Object<CameraModel> cameraModelFromUpdateStatusDto(
            const oatpp::Object<CameraUpdateStatusDto> &dto
    ); //
};

#endif //GAZE_CAMERASERVICE_CPP_H
